
var e = require("../../../common/vendor.js"),
  u = require("../../../api/ajax.js");

require("../../../api/service.js"), require("../../../utils/luch-request/core/Request.js"),
  require("../../../utils/luch-request/core/dispatchRequest.js"), require("../../../utils/luch-request/adapters/index.js"),
  require("../../../utils/luch-request/helpers/buildURL.js"), require("../../../utils/luch-request/utils.js"),
  require("../../../utils/luch-request/core/buildFullPath.js"), require("../../../utils/luch-request/helpers/isAbsoluteURL.js"),
  require("../../../utils/luch-request/helpers/combineURLs.js"), require("../../../utils/luch-request/core/settle.js"),
  require("../../../utils/luch-request/core/InterceptorManager.js"), require("../../../utils/luch-request/core/mergeConfig.js"),
  require("../../../utils/luch-request/core/defaults.js"), require("../../../utils/luch-request/utils/clone.js"),
  require("../../../uni_modules/u-store/js_sdk/Storage.js"), require("../../../config/config.js");

var o = {
  setup: function () {
    var u = e.useStore();
    return {
      login: function (e) {
        u.commit("userModel/login", e);
      },
      logout: function () {
        u.commit("userModel/logout");
      },
      upInfo: function (e) {
        u.commit("userModel/upInfo", e);
      },
      userModel: u.state.userModel
    };
  },
  data: function () {
    return {
      password:'',
      acc:'',
      isLogin: !0,
      dcislogin:0,
      baseList: [{
        name: "photo",
        title: "李白"
      }, {
        name: "lock",
        title: "韩信"
      }, {
        name: "star",
        title: "刘备"
      }, {
        name: "star",
        title: "元芳"
      }]
    };
  },
  onPullDownRefresh: function (e) {
    console.log("onPullDownRefresh", this.userModel.userInfo), this.getUserInfo(!0);
  },
  onLoad: function () {
    this.getUserInfo(!1);
  },
  methods: {
    getUserInfo: function (o) {
      var t = this;
      u.doGetUrl("member.Ucenter/info").then(function (u) {
        console.log("res", u);
        var n = u.data.data;
        0 == n.is_login && t.logout(), t.upInfo(n.user_info), o && e.index.stopPullDownRefresh();
      });
    },
    openUcenter: function () {
      console.log("hasLogin", this.userModel.hasLogin), e.index.navigateTo({
        url: "../info/info"
      })
    },
    openToken: function (u) {
      e.index.navigateTo({
        url: "/pages/" + u
      });
    },
    logout: function () {
      this.logout();
    },
    open() {
      if(this.dcislogin){
        this.openToken('submit/quality')
      }else{
        this.$refs.modal.open();
      }
      
    },
    change(e) {
      console.log('弹窗状态改变：', e);
    },
    userNameInputAction(e){
      this.password=e.detail.value
    },
    inpacc(e){
      this.acc=e.detail.value
    },
    submit(){
      console.log(this.password);
      var t=this
      var form={
        account:t.acc,
        password:t.password
      }
      u.doPostUrl("https://che.fuliaoxx.com/api/user/login",form).then(function (o) {
        console.log("info", o);
        var da = o.data;
        if(da.code==1){
          wx.showToast({
            title: da.msg,
            icon:'success'
          })
          t.openToken('submit/quality')
          t.$refs.modal.close();
          wx.setStorageSync('dcislogin', 1)
        }else{
          wx.showToast({
            title: da.msg,
            icon:"error"
          })
        }
      })
      return

      if(this.password==123456&&this.acc=='夏国朝'){
        this.openToken('submit/quality')
        this.$refs.modal.close();
      }else{
        wx.showToast({
          title: '密码错误',
          icon:"error"
        })
      }
    }
  },
  onLoad(){
    console.log(wx.getStorageSync('dcislogin'));
    this.dcislogin=wx.getStorageSync('dcislogin')
  }
};
Array || (e.resolveComponent("uv-list-item") + e.resolveComponent("uv-list") + e.resolveComponent("uv-input") + e.resolveComponent("uv-cell") + e.resolveComponent("uv-cell-group") + e.resolveComponent("uv-button") + e.resolveComponent("uv-popup") + e.resolveComponent("uv-gap")+ e.resolveComponent("uv-modal")+ e.resolveComponent("uv-image"))(),
  Math || (function () {
    return "../../../uni_modules/uv-list/components/uv-list-item/uv-list-item.js";
  } + function () {
    return "../../../uni_modules/uv-list/components/uv-list/uv-list.js";
  } + function () {
    return "../../../uni_modules/uv-cell/components/uv-cell/uv-cell.js";
  } + function () {
    return "../../../uni_modules/uv-cell/components/uv-cell-group/uv-cell-group.js";
  } + function () {
    return "../../../uni_modules/uv-button/components/uv-button/uv-button.js";
  } + function () {
    return "../../../uni_modules/uv-gap/components/uv-gap/uv-gap.js";
  } + function () {
    return "../../../uni_modules/uv-image/components/uv-image/uv-image.js";
  })();

var t = e._export_sfc(o, [
  ["render", function (u, o, t, n, r, s) {
    return e.e({
      a: e.o(function (e) {
        return s.openUcenter();
      }),
      b: e.p({
        title: n.userModel.userInfo.nick_name,
        note: n.userModel.userInfo.mobile,
        thumb: n.userModel.userInfo.avatar,
        "thumb-size": "lg",
        clickable: !0
      }),
      c: e.o(function (e) {
        return s.openToken("submit/quality");
      }),
      d: e.p({
        title: "质保录入",
        clickable: !0
      }),
      e: e.o(function (e) {
        return s.openToken("ucenter/quality/quality");
      }),
      f: e.p({
        title: "质保列表",
        clickable: !0
      }),
      g: n.userModel.hasLogin,
      z: e.o(function () {
        return s.open()
      }),
      y: e.o(function (e) {
        return s.userNameInputAction(e)
      }),
      ipzh:e.o(function (e) {
        return s.inpacc(e)
      }),
      x:e.o(function () {
        return s.submit()
      }),
      ps:n.password,
      zh:n.acc
    }, n.userModel.hasLogin ? {
      h: e.o(function (e) {
        return s.logout();
      }),
      i: e.p({
        type: "error",
        text: "退出登录",
        size: "large"
      })
    } : {}, {
      j: e.p({
        height: "40",
        bgColor: "#f5f5f5"
      }),
      k: e.p({
        src: "/static/image/bottom.png",
        width: "750rpx",
        mode: "widthFix"
      })
    });
  }]
]);

wx.createPage(t);